/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.poss.api.domain;

import java.util.Date;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author Lakmal
 */
@Entity
public class User {
    private long userId;
    private String userName;
    private String userPhone;
    private String userEmail;
    private String userUsername;
    private String userPassword;
    private String userNic;
    private String userSalary;
    private Date userDob;
    private List<Role> userRoles;
    private List<Sale> userSales;

    @OneToMany(targetEntity=Sale.class, mappedBy="soldUser", cascade=CascadeType.ALL, fetch=FetchType.LAZY) 
    public List<Sale> getUserSales() {
        return userSales;
    }

    public void setUserSales(List<Sale> userSales) {
        this.userSales = userSales;
    }

    @Temporal(TemporalType.TIMESTAMP)
    public Date getUserDob() {
        return userDob;
    }

    public void setUserDob(Date userDob) {
        this.userDob = userDob;
    }

    public String getUserNic() {
        return userNic;
    }

    public void setUserNic(String userNic) {
        this.userNic = userNic;
    }
    
    @ManyToMany(targetEntity=Role.class, cascade=CascadeType.ALL, fetch=FetchType.LAZY) 
    public List<Role> getUserRoles() {
        return userRoles;
    }

    public void setUserRoles(List<Role> userRoles) {
        this.userRoles = userRoles;
    }

    public String getUserSalary() {
        return userSalary;
    }

    public void setUserSalary(String userSalary) {
        this.userSalary = userSalary;
    }
  
    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    @Id
    @GeneratedValue
    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getUserUsername() {
        return userUsername;
    }

    public void setUserUsername(String userUsername) {
        this.userUsername = userUsername;
    }
    
    
}
